﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace QldtSdh.GUI.DaoTao
{
    using BLL;
    using DAL;
    using DAL.Models;
    using QldtSdh.Utils;
    using QldtSdh.GUI.Utils;
    using System.Drawing.Printing;
    using Microsoft.Reporting.WinForms;

    public partial class FormInThoiKhoaBieuGiangVien : QldtSdh.GUI.Common.BaseForm
    {
        public FormInThoiKhoaBieuGiangVien()
        {
            InitializeComponent();
        }

        public LocalReport LocalReport { get { return rv.LocalReport; } }

        public void LoadData(IList<ThoiKhoaBieuForPrint> lst, string pGiangVien, string pDonViPhuTrach, string pHocKyNamHocString, string pChucDanhKy, string pHoTenChucDanhKy)
        {
            var pageSettings = new PageSettings();
            pageSettings.Margins.Top = 30;
            pageSettings.Margins.Bottom = 30;
            pageSettings.Margins.Left = 20;
            pageSettings.Margins.Right = 20;
            pageSettings.Landscape = true;
            pageSettings.PaperSize = new PaperSize("A4", 827, 1169);
            rv.SetPageSettings(pageSettings);

            var lstParam = new List<ReportParameter>(){
                new ReportParameter("pGiangVien", pGiangVien),
                new ReportParameter("pDonViPhuTrach", pDonViPhuTrach),
                new ReportParameter("pHocKyNamHocString", pHocKyNamHocString),
                new ReportParameter("pChucDanhKy", pChucDanhKy),
                new ReportParameter("pHoTenChucDanhKy", pHoTenChucDanhKy)
            };
            rv.LocalReport.SetParameters(lstParam);
            ThoiKhoaBieuForPrintBindingSource.DataSource = lst;

            rv.RefreshReport();
            rv.SetDisplayMode(DisplayMode.PrintLayout);
            rv.ZoomMode = ZoomMode.Percent;
            rv.ZoomPercent = 100;
            rv.PrinterSettings.PrinterName = PrintUtil.GetDefaultPrinter();
        }

        private void FormInThoiKhoaBieuGiangVien_Load(object sender, EventArgs e)
        {
            //this.rv.RefreshReport();
        }
    }
}
